package com.weido.nettyServer.core;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class FilterChain implements  Filter {
    private FilterAsist asist  = new FilterAsist();
    private Integer index =0;

    @Override
    public void doFilter(HttpRequest request, HttpResponse response, FilterChain chain) {
        List<Filter> filters = asist.getFilters();
        System.out.println(index);
        if(index==filters.size()){
            return;
        }
        Filter filter = filters.get(index);
        index++;
        filter.doFilter(request,response,chain);

    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }
}
